<template>
  <div class="cellphonelist">
    <!-- asd -->
    <van-tabs animated>
      <van-tab v-for="item in Accessories" :key="item.id" :title="item.name">
        <div class="main-list">
          <div class="main-list-title" v-for="v in item.data" :key="v.id">
            <div class="main-img">
              <img :src="v.img_url" alt="" />
            </div>
            <h3 class="main-title">{{ v.name }}</h3>
            <div class="main-content">{{ v.content }}</div>
            <div class="main-price">¥ {{ v.price }}</div>
          </div>
        </div>
      </van-tab>
    </van-tabs>
  </div>
</template>
<script>
import axios from 'axios'
export default {
  data() {
    return {
      Accessories: []
    }
  },
  methods: {
    async getAccessories() {
      const res = await axios.get('http://localhost:3000/phone')
      this.Accessories = res.data
    }
  },
  created() {
    this.getAccessories()
  }
}
</script>
<style lang="scss">
.cellphonelist {
  .main-list {
    text-align: center;
    display: flex;
    flex-wrap: wrap;
    .main-list-title {
      box-sizing: border-box;
      width: 50%;
      height: 359px;
      border: 1px solid #eee;
      .main-img {
        margin-top: 20px;
        img {
          width: 176px;
          height: 148px;
        }
      }
      .main-title {
        font-size: 24px;
        font-weight: 500;
      }
      .main-content {
        font-size: 14px;
      }
      .main-price {
        color: red;
        margin-top: 35px;
        font-size: 18px;
      }
    }
  }
}
</style>